from urllib import request
'''3种错误错误类型
Exception 类
traceback 类库
sys 类库
'''
import traceback
import sys

try:
    response = request.urlopen(r'ddddd')
# except Exception as e:
#     print('Exception:',e)
#     # Exception: unknown url type: 'ddddd'
# except:
#     traceback.print_exc()
#     print(traceback.format_exc())
except:
    info = sys.exc_info()
    print(info[0],info[1])

print('Hello Python!!!!')

'''
Exception 所有错误类的基类
使用Exception类作为错误捕捉 能看到错误提示

traceback 能看到具体的错误在哪一行，官方推荐写法
sys.exc_info 能看到错误的类型和错误提示

'''

